package com.travel.service.impl;

import java.util.List;

import com.travel.dao.ScenicFavoriteDao;
import com.travel.dao.impl.ScenicFavoriteDaoImpl;
import com.travel.entity.ScenicFavorite;
import com.travel.service.ScenicFavoriteService;
import com.travel.util.PageInfo;

/**
 * @Title ScenicFavoriteServiceImpl.java
 * @Package com.travel.service.impl
 * @Author zengbochao
 * @Time 2020年10月29日 下午4:13:33
 * @Version 1.0
 * @Description: TODO
 */
public class ScenicFavoriteServiceImpl implements ScenicFavoriteService {

	private ScenicFavoriteDao scenicFavoriteDao = new ScenicFavoriteDaoImpl();

	@Override
	public PageInfo<ScenicFavorite> getScenicFavoriteByPage(int pageNum, int pageSize, int userId) {
		if (pageNum <= 0) {
			pageNum = 1;
		}
		if (pageSize <= 0) {
			pageSize = 2;
		}
		return scenicFavoriteDao.findByPage(pageNum, pageSize, userId);
	}

	@Override
	public boolean insert(ScenicFavorite scenicFavorite) {
		// TODO Auto-generated method stub
		return scenicFavoriteDao.insert(scenicFavorite) > 0 ? true : false;
	}

	@Override
	public boolean deleteById(int scenicId) {
		// TODO Auto-generated method stub
		int i = scenicFavoriteDao.deleteById(scenicId);
		return i > 0 ? true : false;
	}

	@Override
	public List<ScenicFavorite> findbyUserId(int userId, int scenicId) {
		// TODO Auto-generated method stub
		return scenicFavoriteDao.findbyUserId(userId, scenicId);
	}

}
